package com.BlackMesa.models;

import static org.junit.Assert.*;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Before;
import org.junit.Test;

import com.BlackMesa.controllers.TodoListActivity;
import com.google.android.maps.GeoPoint;

import android.graphics.Color;
import android.test.ActivityInstrumentationTestCase2;

public class CatTest extends ActivityInstrumentationTestCase2<TodoListActivity> {
	private Task t1, t2, t3;
	private Category c1, c2, c3;
	private User u1, u2, u3;
	private int color = 0;

	public CatTest() {
		super("com.BlackMesa.models",TodoListActivity.class);
		// TODO Auto-generated constructor stub
	}

	@Before
	public void setUp() throws Exception {
		super.setUp();
		
	}
	
	/*Nick*/
	@Test
	public void testAddTaskTaskBoolean() {
		c1 = new Category("test", color);
		t1 = new Task("one");
		t2 = new Task("two");
		t3 = new Task("three");
		c1.addTask(t1, false);
		c1.addTask(t3, false);
		assertTrue(c1.getTasks().contains(t1));
		assertTrue(c1.getTasks().contains(t3));
		assertFalse(c1.getTasks().contains(t2));
	}
	
	/*Nick*/
	@Test
	public void testContainsTask() {
		c1 = new Category("test", color);
		t1 = new Task("one");
		t2 = new Task("two");
		t3 = new Task("three");
		c1.addTask(t1, false);
		c1.addTask(t3, false);
		assertTrue(c1.getTasks().contains(t1) == c1.containsTask(t1));
		assertTrue(c1.getTasks().contains(t3) == c1.containsTask(t3));
		assertTrue(c1.getTasks().contains(t2) == c1.containsTask(t2));
	}

/*	Cody
	@Test
	public void testequals(){
		Object obj = new Object();
		Object obj2 = null;
		
		
		assertTrue(u1.equals(obj));
		assertFalse(u1.equals(obj2));
		
	}*/
	
	/*Cody*/
	@Test
	public void testAddTaskForDate(){
		GeoPoint geo = new GeoPoint(5,5);
		Date dueDate = null;
		Date dueTime = null;
		c1 = new Category("c1",0);
		try {
			dueDate = (new SimpleDateFormat("MM/dd/yyyy")).parse("12/15/2012");
			dueTime = (new SimpleDateFormat("hh:mm")).parse("12:12");
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		OurLocation l = new OurLocation("Kroger", geo);
		
		
		
		
		Task list = new Task("list", l, c1, dueDate, dueTime, "details" );
		c1.addTaskForDate(list);
		Task list2 = new Task("list2");
		
		assertTrue(c1.containsTask(list));
		assertFalse(c1.containsTask(list2));
	}
	
}
